﻿using System;
using System.Collections;
using Zeus;

using Zeus.Data;
using Zeus.DotNetScript;
using Zeus.UserInterface;
using MyMeta;
using Dnp.Utils;

namespace MyGenerationSample
{


    public class RenderTemplate : DotNetScriptTemplate
    {
        public RenderTemplate(ZeusContext context) : base(context) { }

        //---------------------------------------------------
        // Render() is where you want to write your logic    
        //---------------------------------------------------
        public override void Render()
        {
            string databaseName = input["databaseName"].ToString();
            string tableName = input["tableName"].ToString();
            
            IDatabase database = MyMeta.Databases[databaseName];
            ITable table = database.Tables[tableName];

            output.writeln("Columns for Table '" + table.Name + "'");
            output.writeln("");

            foreach (IColumn column in table.Columns)
            {
                output.writeln(column.Name + " : " + column.DataTypeName);
            }
        }

    }
}
